package top.oylan.example.app.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

import top.oylan.example.app.fragment.MainFragment;

public class MainAdapter extends FragmentPagerAdapter {

    List<MainFragment> fragments;

    public MainAdapter(FragmentManager fm,List<MainFragment> fragments) {
        super(fm);
        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int i) {
        return fragments.get(i);
    }

    @Override
    public int getCount() {
        return fragments !=null?this.fragments.size():0;
    }
}
